<template>
  <div class="dashboard">
    <Navigation></Navigation>
    <UserInfo :homeData="homeData"></UserInfo>
    <el-row type="flex">
      <el-col :span="9">
        <SocialInsurance></SocialInsurance>
      </el-col>
      <el-col :span="9">
        <ProvidentFund></ProvidentFund>
      </el-col>
      <el-col :span="6">
        <el-calendar v-model="value"></el-calendar>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import Navigation from '@/views/dashboard/components/Navigation/Navigation.vue'
import UserInfo from '@/views/dashboard/components/UserInfo/UserInfo.vue'
import { getHomeData } from '@/api/dashboardApi'
import SocialInsurance from '@/views/dashboard/components/SocialInsurance/SocialInsurance.vue'
import ProvidentFund from '@/views/dashboard/components/ProvidentFund/ProvidentFund.vue'

export default {
  name: 'Dashboard',
  data() {
    return {
      homeData: {},
      value: new Date()
    }
  },
  methods: {
    async fetchData() {
      const { data } = await getHomeData()
      this.homeData = data
    }
  },
  computed: {
    ...mapGetters(['name'])
  },
  mounted() {
    this.fetchData()
  },
  components: { ProvidentFund, SocialInsurance, UserInfo, Navigation }
}
</script>

<style lang="scss" scoped>
.dashboard {
.el-calendar{
}
}
</style>
